package com.cat.dataStructure03;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/construct-k-palindrome-strings/
 * @create 2025/11/15 10:22
 * @since JDK17
 */

public class Solution57 {
    public boolean canConstruct(String s, int k) {
        int[] cnt = new int[26];
        for (var x : s.toCharArray()) {
            cnt[x - 'a']++;
        }
        int odd = 0, n = s.length();
        for (int x : cnt) {
            odd += x & 1;
        }
        if (odd > k || n < k) {
            return false;
        }

        return true;
    }
}
